package com.songjia.stream.consumer;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.cloud.stream.messaging.Sink;

import com.songjia.stream.model.User;

/**
 * 
 * 
 * @Description: 自定义消费者
 *
 * @author: songjia
 * @date: 2018年3月27日 上午11:00:11
 */
@EnableBinding(Sink.class)
public class SinkReceiver {

	private static Logger logger = LoggerFactory.getLogger(SinkReceiver.class);

	@Value("${server.port}")
	private String port;

	@StreamListener(Sink.INPUT)
	public void receive(User user) {
		logger.info("Received: {}, Port: {}", user.toString(), port);
	}
}
